home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
isfile
/
isfile.bas
< prev
next >
Wrap
BASIC Source File
|
1995-05-09
|
724b
|
22 lines
Option Explicit
Type OFSTRUCT '136 bytes --- Data Structure for OpenFile call
cBytes As String * 1
fFixedDisk As String * 1
nErrCode As Integer
reserved As String * 4
szPathName As String * 128
End Type
Global Const OF_EXIST = &H4000
Declare Function OpenFile% Lib "KERNEL" (ByVal lpFileName$, lpReOpenBuff As OFSTRUCT, ByVal wStyle%)
Function IsFile% (NameOfFile As String)
'True = File Exists
'False = File does not exist
Dim Result As Integer, Response As OFSTRUCT, OF_EXIST As Integer
Result = OpenFile(NameOfFile, Response, OF_EXIST)
'Response.nErrCode can be used to determine the exact error if needed if the future.
If Result < 0 Then IsFile = False Else IsFile = True
End Function